import 'package:abc/view/GradientButton.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class PaymentResultDialogContent extends StatelessWidget {
  const PaymentResultDialogContent({super.key});

  @override
  Widget build(BuildContext context) {
    // 使用 Stack 放置居中的卡片和底部的关闭按钮
    return Center(
      child: Material(
        type: MaterialType.transparency, // 确保 Material 不会遮挡背景
        child: Padding(
          padding: const EdgeInsets.all(24.0),
          child: Column(
            mainAxisSize: MainAxisSize.min, // 确保 Column 不会撑满屏幕
            children: [
              Stack(
                alignment: Alignment.topCenter,
                children: [
                  // 核心卡片内容
                 _buildPaymentCard(context),
                  Image.asset(
                    'assets/images/pay_dialog_top_bg.png',
                    width: 123,
                    height: 107,
                  ),
                ],
              ),

              const SizedBox(height: 27),

              // 底部关闭按钮 (X)
              GestureDetector(
                onTap: () => Get.back(),
                child: Image.asset(
            'assets/images/dialog_close.png',
            width: 32,
            height: 32,
          ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Widget _buildPaymentCard(BuildContext context) {
    return Container(
      constraints: const BoxConstraints(maxWidth: 300),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(16.0),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [

          const SizedBox(height: 94,),
          // 标题
          const Text(
            '确认支付结果',
            style: TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.bold,
              color: Color(0xFF111111),
            ),
          ),
          const SizedBox(height: 25),

          // 提示文本
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 45.0),
            child: RichText(
              textAlign: TextAlign.center,
              text: const TextSpan(
                style: TextStyle(
                  fontSize: 15,
                  color: Color(0xFF959595),
                  fontWeight: FontWeight.w400,
                  height: 1.5
                ),
                children: [
                  TextSpan(text: '支付后，若'),
                   TextSpan(
                    text: '30分钟',
                    style: TextStyle(
                         fontSize: 15,
                      fontWeight: FontWeight.w400,
                      color: Color(0xFF4D4D4D),
                    ),
                  ),
                  TextSpan(text: '若未到账，请点击'),
                  TextSpan(
                    text: '「在线客服」',
                    style: TextStyle(
                         fontSize: 15,
                      fontWeight: FontWeight.w400,
                      color: Color(0xFF4D4D4D),
                    ),
                  ),
                  TextSpan(text: '上传支付凭证为您处理！'),
                ],
              ),
            ),
          ),
          const SizedBox(height: 37),

          GradientButton(onPressed: () {
             Get.back();
          },text: '确定',margin: EdgeInsetsGeometry.symmetric(horizontal: 33),),

          const SizedBox(height: 17,)
        ],
      ),
    ).paddingOnly(top: 44);
  }


}
